From: Andrew Cooper Date: Mon, 14 Nov 2016 10:15:00 +0000 (+0000) Subject: x86/vmx: Correct the long mode check in vmx_cpuid_intercept() X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~95 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22?a=commitdiff_plain;h=fcb618c025f9251d7e22138f6528595037252c21;p=xen.git x86/vmx: Correct the long mode check in vmx_cpuid_intercept() %cs.L may be set in a legacy mode segment, or clear in a compatibility mode segment; it is not the correct way to check for long mode being active. Both of these situations result in incorrect visibility of the SYSCALL feature in CPUID, and by extension, incorrect behaviour in hvm_efer_valid(). Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich Acked-by: Kevin Tian Release-acked-by: Wei Liu --- diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 9a8f69471b..a18db28f6f 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -2407,7 +2407,6 @@ static void vmx_cpuid_intercept( unsigned int *ecx, unsigned int *edx) { unsigned int input = *eax; - struct segment_register cs; struct vcpu *v = current; hvm_cpuid(input, eax, ebx, ecx, edx); @@ -2416,8 +2415,7 @@ static void vmx_cpuid_intercept( { case 0x80000001: /* SYSCALL is visible iff running in long mode. */ - vmx_get_segment_register(v, x86_seg_cs, &cs); - if ( cs.attr.fields.l ) + if ( hvm_long_mode_enabled(v) ) *edx |= cpufeat_mask(X86_FEATURE_SYSCALL); else *edx &= ~(cpufeat_mask(X86_FEATURE_SYSCALL));